# -*- coding:utf-8 -*-

import pymysql

from flask_script import Manager
from flask_migrate import MigrateCommand,Migrate
from iHome import db, create_app

pymysql.install_as_MySQLdb()


# NOTE:此处引入的目的是让程序模型文件执行一边,用于数据库迁移,否则无法完成迁移命令:python manage.py db migrate -m "initial_db"
from iHome import models


app = create_app("development")

manage = Manager(app)
# 集成数据库的迁移
Migrate(app, db)
manage.add_command("db", MigrateCommand)


if __name__ == '__main__':
    # print(app.url_map)
    # app.run(debug=True)
    manage.run()
